/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.makrobioklub.action.ejb;

import cz.makrobioklub.action.controll.ActionFacadeLocal;
import cz.makrobioklub.action.entity.Action;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.fyx.util.FyxUtility;

/**
 *
 * @author xljan
 */
@Stateless
public class ActionBean implements ActionLocal {
    
    @EJB
    private ActionFacadeLocal actionFacade;

    @Override
    public void createAction(Action action){
        FyxUtility.checkRole(ActionRoles.ACTION_WRITER);
        //TODO nastavit autora akce
        actionFacade.create(action);
    }
    
    @Override
    public void editAction(Action action){
        FyxUtility.checkRole(ActionRoles.ACTION_EDITOR);
        actionFacade.edit(action);
    }
    
    @Override
    public void removeAction(Action action){
        FyxUtility.checkRole(ActionRoles.ACTION_EDITOR);
        actionFacade.remove(action);
    }
    
}
